
# coding: utf-8

# In[1]:


import pandas as pd


# In[3]:


media_cloud600 = pd.read_excel("1Media Cloud 600 Topics_Final categorization.xlsx")


# In[4]:


ner = pd.read_excel("US News Sample - Media Cloud Tagger_above 100 words.xlsx")


# In[5]:


media_cloud600.head()


# In[7]:


media_cloud600_dict = media_cloud600[["tag","Category"]]


# In[14]:


media_cloud600_dict = {}


# In[15]:


for _, row in media_cloud600.iterrows():
    tag = row["tag"]
    category = row["Category"]
    media_cloud600_dict[tag] = category


# In[18]:


ner.replace(media_cloud600_dict,inplace=True)


# In[19]:


ner.to_excel("topic_to_number.xlsx")

